package com.dongzili.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;
import lombok.Getter;

@Getter
public enum UserStatusEnum {
    NORMAL(1, "正常"),
    DISABLE(2, "禁用");

    @EnumValue
    private final Integer code;
    @EnumDesc
    private final String desc;

    UserStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    public static UserStatusEnum objOfName(String name) {
        for (UserStatusEnum e : values()) {
            if (e.name().equals(name)) {
                return e;
            }
        }
        return null;
    }
    public static String descOfName(String name) {
        for (UserStatusEnum e : values()) {
            if (e.name().equals(name)) {
                return e.getDesc();
            }
        }
        return "";
    }

}
